package remato.domain.server.ejb;

import static javax.persistence.GenerationType.AUTO;
import static javax.persistence.TemporalType.DATE;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;

import remato.domain.common.PropertyDef;
import remato.domain.common.PropertySet;
import remato.domain.common.impl.PropertySetImpl;

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class PropertySetEjb extends PropertySetImpl implements PropertySet {
	
	@Override
	@Id
	@GeneratedValue(strategy=AUTO)
	public Long getDbId() {
		return super.getDbId();
	}
	
	@Override
    @Temporal(DATE)
	public Date getUpdatedDate() {
		return super.getUpdatedDate();
	}

	@Override
	@OneToMany( targetEntity=PropertyDefEjb.class, cascade={CascadeType.ALL})
	@JoinColumn(name="property_set")
	public List<PropertyDef> getPropertyDefs() {
		return super.getPropertyDefs();
	}

	@Override
	@Lob
	public String getDescription() {
		return super.getDescription();
	}

	@Override
	public String getName() {
		return super.getName();
	}
	
	/**
	 * Needed to trigger CGLib proxy (ie. if other CGLib-proxies is used as 
	 * parameter.)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		return super.equals(obj);
	}

}
